package com.woniuxy.web.back;

import com.woniuxy.entity.Order;
import com.woniuxy.entity.OrderItem;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.OrderItemService;
import com.woniuxy.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@CrossOrigin(value="http://192.168.6.186:8080",allowCredentials = "true")
//统一前缀为user
@RequestMapping("admin/orderItem")
public class OrderItemController_b {
    @Autowired
    private OrderItemService orderItemService;


    @GetMapping("list/{id}")
    public ResponseEntity<List<OrderItem>> list(@PathVariable int id){
        //获取全部订单信息
        List<OrderItem> orderItems = orderItemService.getByOrderId(id);
        return new ResponseEntity<List<OrderItem>>(orderItems);
    }


}
